#ifndef FK_EVENT_H
#define FK_EVENT_H

#include "FKSystemObject.h"
#include <QVariant>
#include <QList>

#include "fkobjects_global.h"

class FKObject;

class FKOBJECTSSHARED_EXPORT FKEvent : public FKSystemObject{
    Q_OBJECT
public:
    FKEvent(int dummy1=0, int dummy2=0, qint32 dummy3=-1);
    ~FKEvent();
    bool isPropertyNotifier;
    qint32 object() const;
    QString subject() const;
    QVariant value() const;
    QList<qint32> recievers() const;
    qint32 client() const;
    qint32 owner() const;
    qint32 emitter() const;
    static FKEvent* errorEvent(FKEvent* errorSource);
    static FKEvent* errorEvent(QString message, qint32 clientID);
    static FKEvent* createObjectsEvent(qint32 target, QSet<FKObject*> objects);
    static FKEvent* deleteObjectsEvent(qint32 target, QSet<FKObject*> objects);
    static FKEvent* makeAction(qint32 object, QString subject, QVariant value, qint32 client, qint32 owner, qint32 emitter);
    static FKEvent* makeEvent(qint32 object, QString subject, QVariant value, QList<qint32> recievers, qint32 owner=-1);
    static FKEvent* makeEvent(qint32 object, QString subject, QVariant value, qint32 reciever, qint32 owner=-1);
private:
    FKEvent(qint32 object, QString subject=QString(), QVariant value=QVariant(), qint32 reciever=-2, qint32 client=-1, qint32 owner=-1, qint32 emitter=-1);
    FKEvent(qint32 object, QString subject, QVariant value, QList<qint32> recievers, qint32 owner=-1);
    void pack(QDataStream &stream);
    bool load(QDataStream &stream);
    qint32 _object;
    QString _subject;
    QVariant _value;
    QList<qint32> _recievers;
    qint32 _client;
    qint32 _owner;
    qint32 _emitter;
};

#endif // FKEVENT_H
